home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / CIncludes / Serial.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-17  |  2.7 KB  |  124 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Serial.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __SERIAL__
  18. #define __SERIAL__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29.  
  30. #if GENERATINGPOWERPC
  31. #pragma options align=mac68k
  32. #endif
  33.  
  34. #ifdef __CFM68K__
  35. #pragma lib_export on
  36. #endif
  37.  
  38.  
  39. enum {
  40.     baud300                        = 380,
  41.     baud600                        = 189,
  42.     baud1200                    = 94,
  43.     baud1800                    = 62,
  44.     baud2400                    = 46,
  45.     baud3600                    = 30,
  46.     baud4800                    = 22,
  47.     baud7200                    = 14,
  48.     baud9600                    = 10,
  49.     baud19200                    = 4,
  50.     baud57600                    = 0,
  51.     stop10                        = 16384,
  52.     stop15                        = -32768,
  53.     stop20                        = -16384,
  54.     noParity                    = 0,
  55.     oddParity                    = 4096,
  56.     evenParity                    = 12288,
  57.     data5                        = 0,
  58.     data6                        = 2048,
  59.     data7                        = 1024,
  60.     data8                        = 3072
  61. };
  62.  
  63. enum {
  64.     ctsEvent                    = 32,
  65.     breakEvent                    = 128,
  66.     xOffWasSent                    = 128,
  67.     dtrNegated                    = 64,
  68.     ainRefNum                    = -6,                            /*serial port A input*/
  69.     aoutRefNum                    = -7,                            /*serial port A output*/
  70.     binRefNum                    = -8,                            /*serial port B input*/
  71.     boutRefNum                    = -9                            /*serial port B output*/
  72. };
  73.  
  74. enum {
  75.     sPortA,
  76.     sPortB
  77. };
  78.  
  79. typedef SInt8 SPortSel;
  80.  
  81. struct SerShk {
  82.     Byte                            fXOn;                        /*XOn flow control enabled flag*/
  83.     Byte                            fCTS;                        /*CTS flow control enabled flag*/
  84.     unsigned char                    xOn;                        /*XOn character*/
  85.     unsigned char                    xOff;                        /*XOff character*/
  86.     Byte                            errs;                        /*errors mask bits*/
  87.     Byte                            evts;                        /*event enable mask bits*/
  88.     Byte                            fInX;                        /*Input flow control enabled flag*/
  89.     Byte                            fDTR;                        /*DTR input flow control flag*/
  90. };
  91. typedef struct SerShk SerShk;
  92.  
  93. struct SerStaRec {
  94.     Byte                            cumErrs;
  95.     Byte                            xOffSent;
  96.     Byte                            rdPend;
  97.     Byte                            wrPend;
  98.     Byte                            ctsHold;
  99.     Byte                            xOffHold;
  100. };
  101. typedef struct SerStaRec SerStaRec;
  102.  
  103. extern pascal OSErr SerReset(short refNum, short serConfig);
  104. extern pascal OSErr SerSetBuf(short refNum, Ptr serBPtr, short serBLen);
  105. extern pascal OSErr SerHShake(short refNum, const SerShk *flags);
  106. extern pascal OSErr SerSetBrk(short refNum);
  107. extern pascal OSErr SerClrBrk(short refNum);
  108. extern pascal OSErr SerGetBuf(short refNum, long *count);
  109. extern pascal OSErr SerStatus(short refNum, SerStaRec *serSta);
  110.  
  111. #ifdef __CFM68K__
  112. #pragma lib_export off
  113. #endif
  114.  
  115. #if GENERATINGPOWERPC
  116. #pragma options align=reset
  117. #endif
  118.  
  119. #ifdef __cplusplus
  120. }
  121. #endif
  122.  
  123. #endif /* __SERIAL__ */
  124.